<?php
include('../../include/functions.inc.php');
include('../../include/inputbuilder.inc.php');
include('../../include/maintenance.inc.php');

$mEmpresas = unserialize($_SESSION['mEmpresas']);

$builder = new InputBuilder();
$builder->db = $db;

$tabs = $db->query_select('cllg_table_tab', "TABLE_NAME='cllg_empresa'");
?>
<form id="<?php echo $mEmpresas->formName; ?>" name="<?php echo $mEmpresas->formName; ?>" method="post" action="<?php echo $mEmpresas->saveNewUrlPage; ?>">
    <div id="panel" class="">
        <ul class="nav nav-tabs" style="font-weight:bolder">
            <?php
            $ix = 0;
            foreach ($tabs as $t) {
                $ix++;
                ?>
                <li class="active" tabindex="<?php echo $ix; ?>"><a><?php echo $t["CAPTION"]; ?></a></li>
                <?php
            }
            ?>
        </ul>
        <div class="">
            <?php
            $ix = 0;
            foreach( $tabs as $t ) {
                $ix++;
                ?>
                <div class="">
                    <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <th scope="col">
                                <div style="margin-left:60%" class="btn-group">
                                    <input type="button" class="btn btn-info" name="<?php echo $ix; ?>cmdOk" id="cmdOk<?php echo $ix; ?>" value="Guardar" onClick="javascript:formOkBt($(this.form),newAction);jQuery('#cmAddcontainer').show();" />   
                                    <input type="button" name="<?php echo $ix; ?>cmdCancel" id="<?php echo $ix; ?>cmdCancel" class="btn btn-info" value="Cancelar" onClick="loadTable();jQuery('#cmAddcontainer').show();" />      
                                </div>
                            </th>
                        </tr>
                        <tr>
                            <td>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <?php
                                    if( $ix == 1 ) {
                                        ?>  
                                        <tr>
                                            <td width="25%">CORPORACIÓN</td>
                                            <td width="75%">
                                                <input name="CORPORACION" type="text" value="" id="CORPORACION" size="100" maxlength="255" />
                                                <input name="ID" type="hidden" id="ID" value="" />
                                                <input name="STATUS" type="hidden" id="STATUS" value="1" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>* NOMBRE</td>
                                            <td>
                                                <input name="NOMBRE" type="text" value="" id="NOMBRE" size="100" maxlength="255" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>* DIRECCIÓN</td>
                                            <td>
                                                <textarea name="DIRECCION" type="text" value="" rows="4" id="DIRECCION" size="100" maxlength="255" ></textarea>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>WEB</td>
                                            <td>
                                                <input name="WEB" type="text" value="" id="WEB" size="100" maxlength="255" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>PBX</td>
                                            <td>
                                                <input name="PBX" type="text" value="" id="PBX" size="100" maxlength="255" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>OBSERVACIÓN</td>
                                            <td>
                                                <textarea name="OBSERVACION" type="text" value="" id="OBSERVACION" rows="4" size="100" maxlength="255" ></textarea>
                                            </td>
                                        </tr>
                                        <?php
                                    }
                                    $builder->build("cllg_empresa", NULL, $t['ID']);
                                    ?>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                </div>
                <?php
            }
            ?> 
        </div>
    </div>
</form>
<?php
$_SESSION['fields'] = serialize($builder->fieldsArray);
?>